const router = require('koa-router')();
const message = require('../modules/message');

//获取数据
router.get('/usermessage',async (ctx,next) => {
    ctx.body = await message.selectMessage();  
})
//增加数据
router.post('/usermessage',async (ctx,next) => {
    ctx.body = await message.addMessage(ctx.request.body)
})
//删除数据
router.delete('/usermessage/:message_id',async (ctx,next) => {
    ctx.body = await message.deleteMessage(ctx.params);
})
//修改数据
router.put('/usermessage',async (ctx,next) => {
    ctx.body = await message.putMessage(ctx.request.body)
})

module.exports = router;